<script>
export default {
  methods: {
    // 更改状态
    async changeStatus(url, id) {
      const res = await this.$axios.post(url, { id })

      if (res.data.code === 200) {
        this.$message({
          type: 'success',
          message: '修改状态成功~'
        })

        this.search()
      }
    },
    // 删除
    del(url, id) {
      this.$confirm(`确定删除该记录吗?`, '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      })
        .then(async () => {
          const res = await this.$axios.post(url, { id })

          if (res.data.code === 200) {
            this.$message({
              type: 'success',
              message: '删除成功~'
            })

            this.search()
          }
        })
        .catch(err => {})
    }
  }
}
</script>
